// ./src/i18n/index.ts
import { createI18n } from 'vue-i18n';
import { themeConfig } from '@/utils/config';
// element-plus 的ui框架国际化语言配置
import zhCnLocale from 'element-plus/dist/locale/zh-cn.mjs'
import enLocale from 'element-plus/dist/locale/en.mjs'
// 自定义的语言配置
import nextZhCn from './lang/zh-cn';
import nextEn from './lang/en';


// 定义语言国际化内容 zh-cn en
const messages = {
    [zhCnLocale.name.toUpperCase()]: {
        ...zhCnLocale,
        ismsg: { ...nextZhCn, },
    },
    [enLocale.name.toUpperCase()]: {
        ...enLocale,
        ismsg: { ...nextEn, },
    },
};

export const i18n = createI18n({
    silentTranslationWarn: true,
    missingWarn: false,
    legacy :false,
    silentFallbackWarn: true,
    fallbackWarn: false,
    locale: themeConfig.value.globalI18n, // 采用全局参数配置初始化语言 项目中有`zh-cn`、`en`两种
    fallbackLocale: zhCnLocale.name,
    messages,
});
